import apis from "../../http/apis";
export default {
  namespaced: true,
  state: {
    salesmans: {},
  },
  mutations: {

  },
  actions: {
    //新增销售员
    async salesmansAdd(context, params) {
      const { data } = await apis.salesmans.salesmansAdd(params);
      if (data.status) {
        alert(data.message);
      }
    },
    //获取销售员后台数据
    async getSalesmansData(context, params) {

      const { data } = await apis.salesmans.getSalesmans(params);
      return data;
    },
    //通过_id查询销售员信息
    async getSalesmansDataById(context, params) {

      const { data } = await apis.salesmans.getSalesmansById(params);

      return data.data;

    },
    //修改销售员信息
    async modifySalesmansById(context, params) {

      const { data } = await apis.salesmans.modifySalesmansById(params);

      if (data.status) {
        alert(data.message);
        return { status: 'a' };
      }
    },
    //通过_id删除学生
    async getSalesmansDeleteById(context, params) {

      const { data } = await apis.salesmans.getSalesmansDeleteById(params);

      return data.data;

    },

    //-----胡兴泽
    async receiveSalesmanById(context,params){
      // console.log(111111111,params);
      const {data} = await apis.salesmans.receiveSalesmanById(params);
      return data;
    }
  },

}